Component({
  data: {
    active: 0
  },

  methods: {
    onChange(event) {
      let url = ''
      this.setData({ active: event.detail }, () => {
        switch (event.detail) {
          case 0:
            url = '/pages/index/index'
            break
          case 1:
            url = '/pages/comment/comment'
            break
          case 2:
            url = '/pages/socket/socket'
            break
          case 3:
            url = '/pages/source/source'
            break
          case 4:
            url = '/pages/user/user'
            break
        }
        wx.switchTab({
          url
        })
      })
    }
  }
})
